package com.kotodama.infrastructure.tenant.resolver.path;

import com.kotodama.infrastructure.tenant.resolver.TenantResolver;
import jakarta.servlet.http.HttpServletRequest;

/**
 * 假设 URL 形如 /api/v1/{tenantId}/...
 */
public class UrlPathTenantResolver implements TenantResolver {
    @Override
    public String resolveTenantId(HttpServletRequest request) {
        String uri = request.getRequestURI();
        String[] parts = uri.split("/");
        if (parts.length > 3) {
            return parts[3];
        }
        return null;
    }
}
